package lab03.test5;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        String path="D:\\jimi.txt";
        FileOutputStream fileOutputStream=null;
        FileInputStream fileInputStream=null;
        Scanner scanner=new Scanner(System.in);
        try {
            fileInputStream=new FileInputStream(path);
            fileOutputStream=new FileOutputStream(path);
            int tem=0;
            while (tem!=1){
                tem=scanner.nextInt();
                fileOutputStream.write(tem+1);
            }
            int b=0;
            while ((b=fileInputStream.read())!=-1){
                System.out.print((char) (b-1));
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        finally {
            try {
                fileInputStream.close();
                fileOutputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
